package com.qykj.ddhing.pda.demo.dagger2.test4;

import android.app.Application;


/**
 * @author liuxiaofeng QQ:363204195
 * @name ddhing_pda
 * @class name：com.qykj.ddhing.pda.demo.dagger2.test4
 * @class describe
 * @time 2018/7/19 00:06
 * @change
 * @chang time
 * @class describe
 */
public class App extends Application {
    private static AppComponent sAppComponent = null;

    @Override
    public void onCreate() {
        super.onCreate();
        if (sAppComponent == null) {/*这个AppComponent只能初始化一次*/
            sAppComponent = DaggerAppComponent.builder()
                    .appModule(new AppModule(this))
                    .build();
        }
    }

    public AppComponent getAppComponent() {
        //向外界的依赖提供这个AppComponent
        return sAppComponent;
    }
}